package com.jinmdz.fmis.mapper.mapper;

import com.jinmdz.fmis.mapper.entity.ChargeVerifyEntity;
import com.jinmdz.fmis.mapper.mapper.provider.ChargeVerifyProvider;
import org.apache.ibatis.annotations.*;

import java.util.ArrayList;

/**
 * 日结审核表Mapper
 *
 * @author generator
 * @date 2020-03-12 17:08
 */
public interface ChargeVerifyMapper {

    /**
     * 增加ChargeVerify
     *
     * @param entity 数据实体
     * @return
     * @author generator
     * @date 2020-03-12 17:08
     */
    @InsertProvider(type = ChargeVerifyProvider.class, method = "insertChargeVerify")
    @Options(useGeneratedKeys = true, keyProperty = "entity.id", keyColumn = "id")
    void insertChargeVerify(@Param("entity") ChargeVerifyEntity entity);

    /**
     * 删除ChargeVerify
     *
     * @param id             主键
     * @param modifiedUserId 修改用户外键
     * @param version        版本号
     * @return
     * @author generator
     * @date 2020-03-12 17:08
     */
    @Update(" update charge_verify set deleted = 1,modified_user_id = #{modifiedUserId},version = unix_timestamp(now()) where id = #{id} and version = #{version} and unmodified = 0 and deleted = 0 ")
    void deletedForChargeVerify(@Param("id") Integer id, @Param("modifiedUserId") Integer modifiedUserId, @Param("version") Long version);

    /**
     * 修改ChargeVerify
     *
     * @param entity 数据实体
     * @return
     * @author generator
     * @date 2020-03-12 17:08
     */
    @UpdateProvider(type = ChargeVerifyProvider.class, method = "updateChargeVerify")
    void updateChargeVerify(@Param("entity") ChargeVerifyEntity entity);

    /**
     * 查询ChargeVerify实体
     *
     * @param id 主键
     * @return ChargeVerifyEntity
     * @author generator
     * @date 2020-03-12 17:08
     */
    @Select(" select id,deleted,verify_batch_no,verify_charge,verify_time,invoice_count,receipt_count,verify_user_id,remark,funeral_parlour_code,create_user_id,gmt_create,unmodified,modified_user_id,gmt_modified,version from charge_verify where id = #{id} and deleted = 0 limit 1 ")
    ChargeVerifyEntity getChargeVerifyById(@Param("id") Integer id);

    /**
     * 查询ChargeVerify列表
     *
     * @param entity 数据实体
     * @return ChargeVerifyEntity
     * @author generator
     * @date 2020-03-12 17:08
     */
    @SelectProvider(type = ChargeVerifyProvider.class, method = "listChargeVerify")
    ArrayList<ChargeVerifyEntity> listChargeVerify(@Param("entity") ChargeVerifyEntity entity);
}